<template>
  <el-drawer @close="close" title="项目历史记录" :visible.sync="hisDrawer" :with-header="false" size="480px">
    <div class="right-box">
      <div class="title-box flex ac fw" style="margin: 20px 0 0 10px">
        项目记录
      </div>
      <div class="tab-box">
        <el-tabs :value="activeName" @tab-click="tabClick">
          <el-tab-pane v-for="(item, index) in tabList" :key="item.id" :label="item.label"
            :name="item.id"></el-tab-pane>
        </el-tabs>
      </div>
      <el-empty style="margin-top: 150px" description="无数据" v-if="!log_list.length"></el-empty>
      <el-timeline class="timeline" v-loading="logLoaidng" v-if="hisDrawer">
        <el-timeline-item v-for="(item, index) in log_list" :key="index">
          <div class="setp-box">
            <div class="setp-top flex ac jb">
              <p class="time">{{ item.updated_at }}</p>
              <div class="user-box flex ac">
                <img class="avater" :src="item.handlers_image" />
                {{ item.handlers_name + "-" + item.handlers_position }}
              </div>
            </div>
            <div class="setp-content">
              <div class="title" style="font-size: 14px;">{{ item.content }}</div>
              <!-- 勘场凭证 -->
              <template v-if="item.status == 1025">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">收款类型</span>
                    <span class="table-item-content">
                      <template v-if="fieldShowFunc('payment_type')">
                        <span v-if="item.form_data.payment_type == 1">勘场费用</span>
                        <span v-if="item.form_data.payment_type == 2">预付款</span>
                        <span v-if="item.form_data.payment_type == 3">进度款</span>
                        <span v-if="item.form_data.payment_type == 4">尾款</span>
                        <span v-if="item.form_data.payment_type == 5">增项款</span>
                      </template>
                      <span v-else>无权限</span>
                    </span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">收款账户</span>
                    <span class="table-item-content" v-if="fieldShowFunc('receiving_account')">{{
                      item.form_data.receiving_account
                    }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">收款金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('amount_collected')">{{
                      item.form_data.amount_collected
                    }}</span>
                    <span v-else class="table-item-content">无权限</span>
                  </div>

                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">收款凭证</span>
                    <span v-if="!fieldShowFunc('voucher_file')" class="table-item-content">无权限</span>
                  </div>
                </div>
                <div class="img-list-box flex ac fw" v-if="fieldShowFunc('voucher_file')">
                  <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.voucher_file" :key="index"
                    class="img" :src="file.file_url" />
                </div>
              </template>
              <!-- 财务驳回 -->
              <template v-if="item.status == 1020 && item.handlers_position == '财务'">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">驳回理由</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 财务同意 -->
              <template v-if="item.status == 1030">
                <div class="content-table" v-if="item.remark">
                  <div class="table-item">
                    <span class="table-item-title">同意理由</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 分配工程经理 -->
              <template v-if="item.status == 1045">
                <div class="content-table" v-if="item.remark">
                  <div class="table-item">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 勘场资料 -->
              <template v-if="item.status == 1055">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">现场图片</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('scene_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('scene_file')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.scene_file" :key="index"
                      class="img" :src="file.file_url" />
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">勘察报告</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('report_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('report_file')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.report_file" :key="index"
                      class="img" :src="file.file_url" />
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">现场视频</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('video_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('video_file')">
                    <div class="img" @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.video_file"
                      :key="index">
                      <div class="play-icon"><i class="el-icon-caret-right"></i></div>
                      <video :src="file.file_url"></video>
                    </div>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">手绘图</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('sketch_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('sketch_file')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.sketch_file" :key="index"
                      class="img" :src="file.file_url" />
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 上传勘场资料 -->
              <template v-if="item.status == 1060 && item.form_data">
                <div class="content-table">
                  <div class="table-item" v-if="JSON.stringify(item.form_data) != '[]'">
                    <span class="table-item-title">设计文件</span>
                    <span v-if="item.form_data.length" @click="$fileViewHandle(item.form_data[0])" class="file-name">{{
                      item.form_data[0].file_name }}</span>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 对客日志 -->
              <template v-if="item.status == 1200 && item.handlers_position == '客户经理'">
                <div class="content-table">
                  <div class="flex jb fw">
                    <div class="table-item">
                      <span class="table-item-title">进展描述</span>
                      <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div class="table-item" v-if="JSON.stringify(item.log_file) != '[]'">
                    <span class="table-item-title">日志图片</span>
                  </div>
                  <div class="img-list-box flex ac fw">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.log_file" :key="index" class="img"
                      :src="file.file_url" />
                  </div>
                </div>
              </template>
              <!-- 上传设计图 -->
              <template v-if="item.status == 1065">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">平面图</span>
                    <template v-if="fieldShowFunc('plan_drawing')">
                      <span v-if="item.form_data.plan_drawing.length"
                        @click="$fileViewHandle(item.form_data.plan_drawing[0])" class="file-name">{{
                          item.form_data.plan_drawing[0].file_name }}</span>
                      <span class="table-item-content" v-else>--</span>
                    </template>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('plan_drawing_image')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.plan_drawing_image"
                      :key="index" class="img" :src="file.file_url" />
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">效果图</span>
                    <template v-if="fieldShowFunc('effect_drawing')">
                      <span v-if="item.form_data.effect_drawing.length"
                        @click="$fileViewHandle(item.form_data.effect_drawing[0])" class="file-name">{{
                          item.form_data.effect_drawing[0].file_name }}</span>
                      <span class="table-item-content" v-else>--</span>
                    </template>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div v-if="fieldShowFunc('effect_drawing_image')" class="img-list-box flex ac fw">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.effect_drawing_image"
                      :key="index" class="img" :src="file.file_url" />
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">施工图</span>
                    <template v-if="fieldShowFunc('construction_drawing')">
                      <span v-if="item.form_data.construction_drawing.length"
                        @click="$fileViewHandle(item.form_data.construction_drawing[0])" class="file-name">{{
                          item.form_data.construction_drawing[0].file_name }}</span>
                      <span class="table-item-content" v-else>--</span>
                    </template>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div v-if="fieldShowFunc('construction_drawing_image')" class="img-list-box flex ac fw">
                    <img @click="$fileViewHandle(file)"
                      v-for="(file, index) in item.form_data.construction_drawing_image" :key="index" class="img"
                      :src="file.file_url" />
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 提交报价申请 -->
              <template v-if="item.status == 1070">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">预计开工日期</span>
                    <span class="table-item-content" v-if="fieldShowFunc('start_date')">{{ item.form_data.start_date
                      }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">预计完工日期</span>
                    <span class="table-item-content" v-if="fieldShowFunc('end_date')">{{ item.form_data.end_date
                      }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">预计工期</span>
                    <span class="table-item-content" v-if="fieldShowFunc('expect_duration_days')">{{
                      item.form_data.expect_duration_days }}天</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 分配造价员 -->
              <template v-if="item.status == 1080">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 造价单 -->
              <template
                v-if="item.status == 1090 && (item.form_data.start_date && JSON.stringify(item.form_data.length) != '[]')">
                <div class="content-table">
                  <div class="flex jb fw">
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">预计开工日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('start_date')">{{ item.form_data.start_date
                        }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">预计完工日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('end_date')">{{ item.form_data.end_date
                        }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">工期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('duration_days')">{{
                        item.form_data.duration_days }}天</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">建筑面积</span>
                      <span class="table-item-content" v-if="fieldShowFunc('building_area')">{{
                        item.form_data.building_area }}m²</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">报价金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('quotation_amount')">{{
                        item.form_data.quotation_amount }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">基础装修费用</span>
                      <span class="table-item-content" v-if="fieldShowFunc('basic_decoration_fee')">{{
                        item.form_data.basic_decoration_fee }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">主材采购费</span>
                      <span class="table-item-content" v-if="fieldShowFunc('material_costs')">{{
                        item.form_data.material_costs }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">税金</span>
                      <span class="table-item-content" v-if="fieldShowFunc('quotation_taxes')">{{
                        item.form_data.quotation_taxes }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">成本金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('cost_amount')">{{ item.form_data.cost_amount
                        }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">现场采购成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('procurement_cost')">{{
                        item.form_data.procurement_cost }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">公司集采成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('centralized_procurement_cost')">{{
                        item.form_data.centralized_procurement_cost }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">管理成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('management_costs')">{{
                        item.form_data.management_costs }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">利润金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('profit_amount')">{{
                        item.form_data.profit_amount }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">报价类型</span>
                      <span class="table-item-content" v-if="fieldShowFunc('quotation_type')">
                        <template v-if="item.form_data.quotation_type == 1">基础施工报价（首次）</template>
                        <template v-if="item.form_data.quotation_type == 2">基础施工报价（调整）</template>
                        <template v-if="item.form_data.quotation_type == 3">增减项施工报价</template>
                      </span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" v-if="item.remark" style="width: 100%;">
                      <span class="table-item-title">备注描述</span>
                      <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div v-if="item.form_data.project_quotation_file" class="table-item">
                    <span class="table-item-title">报价单文件</span>
                    <span v-if="fieldShowFunc('quotation_file') && item.form_data.project_quotation_file.quotation_file"
                      @click="$fileViewHandle(item.form_data.project_quotation_file.quotation_file[0])"
                      class="file-name">{{
                        item.form_data.project_quotation_file.quotation_file[0].file_name }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div v-if="item.form_data.project_quotation_file" class="table-item">
                    <span class="table-item-title">利润单文件</span>
                    <span
                      v-if="fieldShowFunc('profit_statement_file') && item.form_data.project_quotation_file.profit_statement_file"
                      @click="$fileViewHandle(item.form_data.project_quotation_file.profit_statement_file[0])"
                      class="file-name">{{
                        item.form_data.project_quotation_file.profit_statement_file[0].file_name
                      }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="item.form_data.project_quotation_file">
                    <span class="table-item-title">成本单文件</span>
                    <span v-if="fieldShowFunc('cost_list_file') && item.form_data.project_quotation_file.cost_list_file"
                      @click="$fileViewHandle(item.form_data.project_quotation_file.cost_list_file[0])"
                      class="file-name">{{
                        item.form_data.project_quotation_file.cost_list_file[0].file_name }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 工程经理拒绝接单 -->
              <template v-if="item.status == 1090 && item.handlers_position == '工程经理'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 工程经理同意造价单 -->
              <template v-if="item.status == 1092 && item.handlers_position == '工程经理'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 造价主管同意造价单 -->
              <template v-if="item.status == 1095 && item.handlers_position == '造价主管'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 合同信息 -->
              <template v-if="item.status == 1105 && item.form_data && JSON.stringify(item.form_data != '[]')">
                <div class="content-table" v-if="item.form_data.account_name">
                  <div class="flex jb fw">
                    <div class="table-item" style="width: 100%;">
                      <span class="table-item-title">签约主体</span>
                      <span class="table-item-content" v-if="fieldShowFunc('account_name')">{{
                        item.form_data.account_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">最终报价金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('system_quotation')">{{
                        item.form_data.system_quotation }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">合同签约金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_price')">{{
                        item.form_data.contract_price }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">签约报价比</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_quotation_ratio')">{{
                        item.form_data.contract_quotation_ratio }}元</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">工期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_duration_days')">{{
                        item.form_data.contract_duration_days }}天</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">合同开工日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_commencement_date')">{{
                        item.form_data.contract_commencement_date }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">合同完工日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_completion_date')">{{
                        item.form_data.contract_completion_date }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div v-if="JSON.stringify(item.form_data.contract_files) != '[]' && item.form_data.contract_files"
                    class="table-item">
                    <span class="table-item-title">合同附件</span>
                    <span v-if="fieldShowFunc('contract_files') && item.form_data.contract_files"
                      @click="$fileViewHandle(item.form_data.contract_files[0])" class="file-name">{{
                        item.form_data.contract_files[0].file_name }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 预付款凭证 -->
              <template v-if="item.status == 1110 && item.form_data">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">预付款金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('amount_collected')">{{
                      item.form_data.amount_collected }}元</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">预付款凭证</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('voucher_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('voucher_file')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.voucher_file"
                      :key="index" class="img" :src="file.file_url" />
                  </div>
                </div>
              </template>
              <!-- 财务不通过预付款凭证 -->
              <!-- <template v-if="item.status == 1105 && item.handlers_position == '财务' && item.remark">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark }}</span>
                  </div>
                </div>
              </template> -->
              <!-- 对客报价 -->
              <template v-if="(item.status == 1100 || item.status == 1102) && item.handlers_position == '客户经理'">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">原报价金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('old_amount')">{{ item.form_data.old_amount
                      }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">最终报价金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('new_amount')">{{ item.form_data.new_amount
                      }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">优惠金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('discount_amount')">{{
                      item.form_data.discount_amount }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '无' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 客户总监拒绝对客报价审核 -->
              <template v-if="item.status == 1095 && item.handlers_position == '客户总监'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 客户总监同意对客报价审核 -->
              <template v-if="item.status == 1102 && item.handlers_position == '客户总监'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content">{{ item.remark || '无' }}</span>
                  </div>
                </div>
              </template>
              <!-- 确认施工 -->
              <template v-if="item.status == 1118 && item.form_data && item.handlers_position == '工程监理'">
                <div class="content-table">
                  <div class="flex ac jb fw">
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">开工日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('start_date')">{{ item.form_data.start_date
                        }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%;">
                      <span class="table-item-title">工长</span>
                      <span class="table-item-content" v-if="fieldShowFunc('foreman_name')">{{
                        item.form_data.foreman_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注描述</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="item.form_data.start_file.length">
                    <span class="table-item-title">开工图片</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('start_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw" v-if="fieldShowFunc('start_file')">
                    <img @click="$fileViewHandle(file)" v-for="(file, index) in item.form_data.start_file" :key="index"
                      class="img" :src="file.file_url" />
                  </div>
                </div>
              </template>
              <!-- 施工记录 -->
              <template v-if="item.status == 1120 && item.handlers_position == '工程监理' &&
                item.form_data.is_overdue">
                <div class="content-table">
                  <div class="flex jb fw">
                    <div class="table-item" style="width:50%;">
                      <span class="table-item-title">施工进度</span>
                      <span class="table-item-content" v-if="fieldShowFunc('construction_progress')">
                        <template v-if="item.form_data.construction_progress == 10">待进场</template>
                        <template v-if="item.form_data.construction_progress == 20">施工中</template>
                        <template v-if="item.form_data.construction_progress == 30">一次预警</template>
                        <template v-if="item.form_data.construction_progress == 40">二次预警</template>
                        <template v-if="item.form_data.construction_progress == 50">已超期</template>
                        <template v-if="item.form_data.construction_progress == 60">停工中</template>
                        <template v-if="item.form_data.construction_progress == 70">已完工</template>
                      </span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:50%;">
                      <span class="table-item-title">是否超期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('construction_progress')">{{
                        item.form_data.is_overdue == 1 ? '是'
                          : '否' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;" v-if="item.form_data.is_overdue == 1">
                      <span class="table-item-title">超期类型</span>
                      <span class="table-item-content" v-if="fieldShowFunc('overdue_type')">
                        <template v-if="item.form_data.overdue_type == 1">客户原因</template>
                        <template v-if="item.form_data.overdue_type == 2">供应商原因</template>
                        <template v-if="item.form_data.overdue_type == 3">物业原因</template>
                        <template v-if="item.form_data.overdue_type == 4">城管审批</template>
                        <template v-if="item.form_data.overdue_type == 5">不可抗力</template>
                        <template v-if="item.form_data.overdue_type == 6">现场管理</template>
                        <template v-if="item.form_data.overdue_type == 7">图纸变更</template>
                        <template v-if="item.form_data.overdue_type == 8">其他原因</template>
                      </span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;" v-if="item.form_data.is_overdue == 1">
                      <span class="table-item-title">超期原因</span>
                      <span class="table-item-content" v-if="fieldShowFunc('reason_overdue')">{{
                        item.form_data.reason_overdue }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;">
                      <span class="table-item-title">施工阶段</span>
                      <span class="table-item-content" v-if="fieldShowFunc('construction_stage')">{{
                        item.form_data.construction_stage
                      }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;">
                      <span class="table-item-title">施工内容</span>
                      <span class="table-item-content" v-if="fieldShowFunc('content')">{{ item.form_data.content || '--'
                        }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;" v-if="item.remark">
                      <span class="table-item-title">备注</span>
                      <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width:100%;"
                      v-if="item.construction_files && JSON.stringify(item.construction_files) != '[]'">
                      <span class="table-item-title">日志文件</span>
                      <span v-if="fieldShowFunc('construction_files') && item.construction_files"
                        @click="$fileViewHandle(item.construction_files[0])" class="file-name">{{
                          item.construction_files[0].file_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                </div>
              </template>
              <!-- 节点验收 -->
              <template v-if="item.status == 1120 && item.handlers_position == '工程经理'">
                <div class="content-table">
                  <div class="table-item" v-for="(child, childIndex) in item.form_data" :key="childIndex">
                    <span class="table-item-title">{{ child.node_name }}</span>
                    <!-- 图片视频 -->
                    <template v-if="child.file.length">
                      <div class="img-list-box flex ac fw">
                        <template v-for="(file, fileIndex) in child.file">
                          <div v-if="!isImageUrl(file.file_url)" class="img" @click="$fileViewHandle(file)">
                            <div class="play-icon"><i class="el-icon-caret-right"></i></div>
                            <video :src="file.file_url"></video>
                          </div>
                          <img v-else @click="$fileViewHandle(file)" class="img" :src="file.file_url" />
                        </template>
                      </div>
                    </template>
                    <!-- 文字 -->
                    <template v-else>
                      <span class="table-item-content">{{ child.content || '--' }}</span>
                    </template>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 节点验收拒绝,拒绝 -->
              <template v-if="item.status == 1120 && (item.handlers_position == '工程监理' ||
                item.handlers_position == '工程部经理'
              ) && !item.form_data.is_overdue">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 节点进度款提交 -->
              <template v-if="item.status == 1120 && item.handlers_position == '客户经理' && !item.form_data.is_overdue">
                <div class="content-table">
                  <div class="table-item">
                    <span class="table-item-title">进度款金额</span>
                    <span class="table-item-content" v-if="fieldShowFunc('amount_collected')">{{
                      item.form_data.amount_collected || '--' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">收款账户</span>
                    <span class="table-item-content" v-if="fieldShowFunc('receiving_account')">{{
                      item.form_data.receiving_account || '--' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="JSON.stringify(item.form_data.voucher_file) != '[]'">
                    <span class="table-item-title">进度款凭证</span>
                    <span class="table-item-content" v-if="!fieldShowFunc('voucher_file')">无权限</span>
                  </div>
                  <div class="img-list-box flex ac fw"
                    v-if="JSON.stringify(item.form_data.voucher_file) != '[]' && fieldShowFunc('voucher_file')">
                    <img v-if="item.form_data.voucher_file" @click="$fileViewHandle(item.form_data.voucher_file[0])"
                      class="img" :src="item.form_data.voucher_file[0].file_url" />
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content" v-if="fieldShowFunc('remark')">{{ item.remark || '--' }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                </div>
              </template>
              <!-- 节点进度款 财务驳回 -->
              <template v-if="item.status == 1120 && item.handlers_position == '财务'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 确认是否有增减项 -->
              <template v-if="item.status == 1130 && item.handlers_position == '客户经理'">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 结算单 -->
              <template v-if="item.status == 1135 && item.handlers_position == '造价员'">
                <div class="content-table">
                  <div class="flex jb fw">
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">合同签约金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('contract_price')">{{
                        item.form_data.contract_price || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">增减项总金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('changes_amount')">{{
                        item.form_data.changes_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">应结算金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('settlement_amount')">{{
                        item.form_data.settlement_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">现场采购成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('procurement_cost')">{{
                        item.form_data.procurement_cost || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">公司集采成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('centralized_procurement_cost')">{{
                        item.form_data.centralized_procurement_cost || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">管理成本</span>
                      <span class="table-item-content" v-if="fieldShowFunc('management_costs')">{{
                        item.form_data.management_costs || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">利润金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('profit_amount')">{{
                        item.form_data.profit_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">已付款金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('paid_amount')">{{ item.form_data.paid_amount
                        || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 100%">
                      <span class="table-item-title">待付款金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('unpaid_amount')">{{
                        item.form_data.unpaid_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 100%">
                      <span class="table-item-title">项目结算单</span>
                      <span
                        v-if="item.form_data.profit_statement_file.settlement_file.length && fieldShowFunc('settlement_file')"
                        @click="$fileViewHandle(item.form_data.profit_statement_file.settlement_file[0])"
                        class="file-name">{{
                          item.form_data.profit_statement_file.settlement_file[0].file_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 100%">
                      <span class="table-item-title">工程量清单</span>
                      <span
                        v-if="item.form_data.profit_statement_file.inventory_file.length && fieldShowFunc('inventory_file')"
                        @click="$fileViewHandle(item.form_data.profit_statement_file.inventory_file[0])"
                        class="file-name">{{
                          item.form_data.profit_statement_file.inventory_file[0].file_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 100%">
                      <span class="table-item-title">利润单</span>
                      <span
                        v-if="item.form_data.profit_statement_file.profit_statement_file.length && fieldShowFunc('profit_statement_file')"
                        @click="$fileViewHandle(item.form_data.profit_statement_file.profit_statement_file[0])"
                        class="file-name">{{
                          item.form_data.profit_statement_file.profit_statement_file[0].file_name }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 拒绝结算单 -->
              <template v-if="item.status == 1130 &&
                (item.handlers_position == '工程经理' || item.handlers_position == '造价主管')">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 通过结算单 -->
              <template v-if="(item.status == 1135 || item.status == 1138) &&
                (item.handlers_position == '工程经理' || item.handlers_position == '造价主管')">
                <div class="content-table">
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
              <!-- 尾款凭证 -->
              <template v-if="item.status == 1145 && item.handlers_position == '客户经理'">
                <div class="content-table">
                  <div class="flex jb fw">
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">结算优惠金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('settlement_discount_amount')">{{
                        item.form_data.settlement_discount_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">最终结算总额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('final_settlement_amount')">{{
                        item.form_data.final_settlement_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">待付尾款金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('unpaid_amount')">{{
                        item.form_data.unpaid_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">实付尾款金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('amount_collected')">{{
                        item.form_data.amount_collected || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">最终利润金额</span>
                      <span class="table-item-content" v-if="fieldShowFunc('final_profit_amount')">{{
                        item.form_data.final_profit_amount || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 50%">
                      <span class="table-item-title">结算完成日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('settlement_completion_date')">{{
                        item.form_data.settlement_completion_date || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                    <div class="table-item" style="width: 100%">
                      <span class="table-item-title">质保截止日期</span>
                      <span class="table-item-content" v-if="fieldShowFunc('warranty_deadline_date')">{{
                        item.form_data.warranty_deadline_date || '--' }}</span>
                      <span class="table-item-content" v-else>无权限</span>
                    </div>
                  </div>
                  <div class="table-item">
                    <span class="table-item-title">付款凭证</span>
                    <span v-if="item.form_data.voucher_file && fieldShowFunc('voucher_file')"
                      @click="$fileViewHandle(item.form_data.voucher_file[0])" class="file-name">{{
                        item.form_data.voucher_file[0].file_name }}</span>
                    <span class="table-item-content" v-else>无权限</span>
                  </div>
                  <div class="table-item" v-if="item.remark">
                    <span class="table-item-title">备注</span>
                    <span class="table-item-content">{{ item.remark || '--' }}</span>
                  </div>
                </div>
              </template>
            </div>
          </div>
        </el-timeline-item>
      </el-timeline>
    </div>
  </el-drawer>
</template>
<script>
export default {
  name: "",
  props: {
    fieldList: {
      default: {},
      required: false,
    },
    addDialogVisible: {
      type: Boolean,
      default: false,
      required: false,
    },
    logLoaidng: {
      type: Boolean,
      default: false,
      required: false,
    },
    log_list: {
      type: Array,
      default: [],
      required: false,
    },
    activeName: {
      type: String,
      default: "0",
      required: false,
    },
  },
  data() {
    return {
      hisDrawer: false,
      tabList: [
        {
          label: "全部",
          id: '0'
        },
        {
          label: "勘场记录",
          id: '1'
        },
        {
          label: "报价记录",
          id: '2'
        },
        {
          label: "合同记录",
          id: '3'
        },
        {
          label: "施工记录",
          id: '4'
        },
        // {
        //   label: "施工日志",
        //   id: '6'
        // },
        {
          label: "收尾记录",
          id: '5'
        }
      ],
    };
  },
  watch: {
    addDialogVisible(val1, val2) {
      this.hisDrawer = this.addDialogVisible;
    },
  },
  computed: {},
  mounted() { },
  methods: {
    tabClick(e) {
      let tabList = this.tabList;
      this.$emit("tabClick", tabList[Number(e.index)].id);
    },
    close() {
      this.$emit("close", true);
    },
    // 是否图片
    isImageUrl(url) {
      const imageExtensions = ['jpg', 'png', 'gif', 'jpeg', 'webp', 'bmp'];
      const parsedUrl = new URL(url);
      const path = parsedUrl.pathname.toLowerCase();
      const ext = path.substring(path.lastIndexOf('.') + 1);
      return imageExtensions.includes(ext);
    },
    // 判断是否显示
    fieldShowFunc(field) {
      let fieldList = this.fieldList;
      return fieldList[field] || true;
    },
  },
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
</style>